import { VFC, lazy } from 'react';
import { Router as Rter, useHistory, Route as Rt, Link, withRouter, Switch, RouteProps, RouteComponentProps, Redirect } from 'react-router-dom';
import { Wait, Header } from '@common';
import { PageLoading } from 'zw-components';
import cls from './index.module.less';
const Router: any = Rter;
const Route: any = Rt;
const PorjectListPage = lazy(() => {
    return Promise.all([import("./project-list/index"), Wait(500)]).then(res => res[0]);
});
const PorjectPage = lazy(() => {
    return Promise.all([import("./project/index"), Wait(500)]).then(res => res[0]);
});
const ProxyPage: VFC<RouteProps> = (props) => {
    const history = useHistory();
    const pathName: string = (props as any).match.path.replace('*', '');
    console.log(pathName)
    return (
        <Switch>
            <Route exact path={pathName + 'projects'} component={PorjectListPage}></Route>
            <Route exact path={pathName + 'project/:id'} component={PorjectPage}></Route>
        </Switch>
    );
}

export default withRouter(ProxyPage);